{% extends "oa/base.html" %}
{% load i18n static %}
{% block title %} 产品价格指导 {% endblock %}
{% block content %}
<section class="panel">
        <div class="panel-body">
            <form method="get" action="{{ request.path }}" class="form-inline">
                <input type="hidden" name="sales_channel_type" value="{{ request.GET.sales_channel_type }}">
                <div class="form-group">
                    <label for="q">搜索:</label>
                    <input type="text" class="form-control" name="q" value="{{ request.GET.q }}" id="q">
                </div>{% if sales_channels %}
                <div class="form-group">
                    <label for="sales_channel_id">渠道名称:</label>
                    <select name="sales_channel_id" id="sales_channel_id" class="form-control">
                        <option value="">-----</option>
                        {% for sc in sales_channels %}
                        {% ifequal sc.pk|escape request.GET.sales_channel_id %}
                        <option value="{{ sc.pk }}" selected>{{ sc.name }}</option>
                        {% else %}
                        <option value="{{ sc.pk }}">{{ sc.name }}</option>
                        {% endifequal %}
                        {% endfor %}
                    </select>
                </div>{% endif %}
                <button type="submit" class="btn btn-default">搜索</button>
{#                <a target="_blank"#}
{#                   href="?excel=1&sales_channel_id={{ request.GET.sales_channel_id }}&date_end={{ request.GET.date_end }}&q={{ request.GET.q }}">#}
{#                    <span type="submit" class="btn btn-info">导出EXCEL</span>#}
{#                </a>#}
            </form>
        </div>
    </section>
    <section class="panel">
        <div class="panel-heading">
            <h3>
                产品价格指导
            </h3>
        </div>
        <div class="panel-body table-responsive">
            <table class="table table-striped table-bordered table-responsive">
                <thead>
                <tr>
                    <th>产品编号</th>
                    <th>产品名称</th>
                    <th>渠道名称</th>
                    <th>金额</th>
                    <th>更新时间</th>
                    <th>历史价格</th>
                </tr>
                </thead>
                <tbody>
                {% for row in objects %}
                    <tr>
                        <td>{{ row.package_group.code }}</td>
                        <td>{{ row.package_group.name }}</td>
                        <td>{{ row.sales_channel.name }}</td>
                        <td>{{ row.price }}</td>
                        <td>{{ row.datetime_created }}</td>
                        <td>
                            <ul>
                                {% for rc in row.histories %}
                                    <li>{{ rc.price }} [{{ rc.datetime_created }}]</li>
                                {% endfor %}
                            </ul>
                        </td>
                    </tr>
                {% endfor %}
                </tbody>
            </table>
        </div>
    </section>
{% endblock %}